﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Pibby.Controls
{
	public class ListViewEx : ListView
	{
		public void SelectAll()
		{
			foreach (ListViewItem item in this.Items)
			{
				if (!item.Checked)
					item.Checked = true;
			}
		}
		
		public void DeselectAll()
		{
			foreach (ListViewItem item in this.Items)
			{
				if (item.Checked)
					item.Checked = false;
			}
		}

		public void AutoSizeColumns()
		{
			foreach (ColumnHeader header in this.Columns)
				header.Width = -1;
		}

	}

	public class ListViewTypeCombo : ComboBox
	{
		public ListViewTypeCombo()
		{
			this.DropDownStyle = ComboBoxStyle.DropDownList;

			Array a = Enum.GetValues(typeof(View));
			foreach (View v in a)
			{
				this.Items.Add(v.ToString());
			}

			// Default view is Details
			this.Text = View.Details.ToString();
		}

	}
}
